;(function($){
	$(function(){
		$.idcode.setCode();
		
		$("form").validate({
			messages:{
				uname:"用户名不能为空",
				upwd:"密码不能为空"
			},
			rules:{
				uname:"required",
				upwd:"required"
			},
			
			submitHandler:function(){
				var IsBy=$.idcode.validateCode();
				if (IsBy != true) {
					layer.msg('验证码错误');
                    return false;
				}
				
				
				$.ajax({
					url:"../../servser/loginServer.php",
					type:"post",
					data:$("form").serialize(),
					dataType:"json"
				}).then(function(res){
					if (res.status==1) {
						layer.alert(res.msg,{
							icon: 1,
                            skin: 'layer-ext-moon' 
						});
						 window.location="index1.html";
						
						localStorage.setItem("userInfo",JSON.stringify(res.data));
						
					}
					
				})
				
				
			}
		})
		
	})
})(jQuery)
